package models;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import play.db.jpa.Model;

@Entity
public class SpotConfiguration extends Model {
	@ManyToOne(optional=false)
	private Establishment establishment;
	
	@OneToMany(cascade=CascadeType.ALL, orphanRemoval=true, fetch=FetchType.LAZY)
	@JoinColumn(name="spotconfiguration_id")
	private Set<SpotConfigurationAttribute> attributes = new HashSet<SpotConfigurationAttribute>();

	public Set<SpotConfigurationAttribute> getAttributes() {
		return attributes;
	}

	public void setAttributes(Set<SpotConfigurationAttribute> attributes) {
		this.attributes = attributes;
	}

	public Establishment getEstablishment() {
		return establishment;
	}

	public void setEstablishment(Establishment establishment) {
		this.establishment = establishment;
	}
}
